The TADS Alternate Library
Version 2.0

Global Command Variable Functions


Copyright 2000 by Kevin Forchione.
This is part of the TADS Alternate Library Authors Manual.

Introduction and Table of Contents




Global Command Variable Functions

 

Alt provides several global command functions. These functions can provide information concerning a specific global command variable to functions and methods similarly to the TADS built-in parserGetObj() function. The functions and the variables returned are:

 

Function

global variable

gCommand()

Returns the string of words that form the player command for this turn of command execution.

gActor()

Returns the actor object

gVerb()

Returns the verb object

gDoList()

Returns the multiple direct-object list that gets passed to preCommand() and endCommand() or an empty list

gDobj()

Returns the current direct-object as supplied by the parser for command execution or nil

gPrep()

Returns the preposition object or nil

gIobj()

Returns the indirect-object or nil

gLocation()

Returns the actor’s scope ceiling.

gStatus()

Returns the status of command as established by the author (by setting it manually) or by the parser corresponding to one of the EC status codes

 

Global command variables can be set simply by passing the desired value as the parameter of the function. For instance to set the global variable for the direct object you would pass the value as follows:

 

          gDobj(myDobj);

 

where myDobj is either nil or an object. Alt automatically sets global variables at preCommand(), verb.verbAction(), postAction(), and endCommand().

 

gLocation()

 

The exception to this is gLocation(), which cannot be set. The gLocation() function only returns a value. You can pass a sense object to the function, which will return the scope ceiling for the actor for that particular sense. For example, gLocation(sound) will return the actor’s scope ceiling for hearing objects.